package com.nhic.blog.Utils;

import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.List;

public class ConvertUtil {
    /**
     * 用于转换tagIds字符串为集合
     * 字符串转换为集合
     * @param ids 字符串
     * @return 返回Long类型的集合
     */
    public static List<Long> convertToList(String ids) {
        ArrayList<Long> list = new ArrayList<>();
        if(!StringUtils.isEmpty(ids)){
            String[] strings = ids.split(",");
            for (int i = 0; i < strings.length; i++) {
                list.add(new Long(strings[i]));
            }
        }
        return list;
    }

   /*
      public static List<String> convertToList2(String names) {
        ArrayList<String> list = new ArrayList<>();
        if(!StringUtils.isEmpty(names)){
            String[] strings = names.split(",");
            for (int i = 0; i < strings.length; i++) {
                list.add(new String(strings[i]));
            }
        }
        return list;
    }*/
}
